package com.goddess.yeecolor.webview;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

import com.goddess.yeecolor.R;
import com.goddess.yeecolor.base.BaseActivity;
import com.goddess.yeecolor.tools.MyUrl;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * 作者: CaoJunping
 * 时间: 2017/2/9
 * 作用: ******
 * 备注: 女神优品webview
 */
public class YouYaYoupinWebView extends BaseActivity {
    @InjectView(R.id.title_content)
    TextView titleContent;
    @InjectView(R.id.title_toobar)
    Toolbar titleToobar;
    @InjectView(R.id.webview)
    WebView webview;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        setTheme(R.style.AppTheme);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview_youpin_activity);
        ButterKnife.inject(this);
        initData();
        initOnClck();
    }

    @Override
    public void initOnClck() {
        titleToobar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setFiish(YouYaYoupinWebView.this);
            }
        });
    }

    @Override
    public void initFindView() {

    }

    @Override
    public void initData() {
        titleContent.setText("女神优品");
        titleToobar.setNavigationIcon(R.mipmap.back);

        webview.loadUrl(MyUrl.YOUPIN);
        webview.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
    }
}
